/**
 * @a https://leetcode.cn/problems/missing-number/
 */

#include "common.h"

class Solution
{
public:
    int missingNumber(vector<int> &nums)
    {
        int sz = nums.size(), xor_sum = 0;
        for(int i = 0; i <= sz; ++i)
        {
            xor_sum ^= i;
        }
        for(auto num : nums){
            xor_sum ^= num;
        }
        return xor_sum;
    }
};